package com.qingcheng.controller.order;

import com.alibaba.dubbo.config.annotation.Reference;
import com.qingcheng.pojo.order.CategoryReport;
import com.qingcheng.service.order.CategoryReportService;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/categoryReport")
public class CategoryReportController {
    @Reference
    private CategoryReportService categoryReportService;

    /**
     * 定义查询指定当前日期的前一天的订单报表信息
     * @return
     */
    @GetMapping("/countCategoryReport")
    public List<CategoryReport> countCategoryReport(){
        LocalDate localDate=LocalDate.now().minusDays(1);
        return categoryReportService.countCategory(localDate);
    }

    @GetMapping("/totalCategory")
    public List<Map> totalCategory(String date1,String date2){
        return categoryReportService.totalCategory(date1,date2);
    }

}
